<?php
/*
 * @ https://EasyToYou.eu - IonCube v11 Decoder Online
 * @ PHP 7.2 & 7.3
 * @ Decoder version: 1.1.6
 * @ Release: 10/08/2022
 */

// Decoded file for php version 71.
namespace app\admin\service;

require_once "keygen.php";
class UpdateService
{
    public static function isAuth()
    {
    }
    public static function installSql()
    {
    }
    public static function initWeiqinConfigData()
    {
        if(longbingIsWeiqin()) {
            global $_GPC;
            global $_W;
            $uniacid = $_W["uniacid"];
            if(!empty($uniacid)) {
                $app_config = longbingGetAppConfig($uniacid);
                if(empty($app_config) || empty($app_config["is_sync"])) {
                    $weiqing_wx_app_model = new \app\Common\model\LongbingWeqingWxApp();
                    $weiqing_wx_app = $weiqing_wx_app_model->getApp(["uniacid" => $uniacid]);
                    if(!empty($weiqing_wx_app)) {
                        $data = ["is_sync" => 1];
                        if(isset($weiqing_wx_app["key"]) && !empty($weiqing_wx_app["key"])) {
                            $data["appid"] = $weiqing_wx_app["key"];
                        }
                        if(isset($weiqing_wx_app["secret"]) && !empty($weiqing_wx_app["secret"])) {
                            $data["app_secret"] = $weiqing_wx_app["secret"];
                        }
                        if(isset($weiqing_wx_app["name"]) && !empty($weiqing_wx_app["name"])) {
                            $data["mini_app_name"] = $weiqing_wx_app["name"];
                        }
                        $app_config_model = new \app\admin\model\AppConfig();
                        if(empty($app_config)) {
                            $data["uniacid"] = $uniacid;
                            $data["force_phone"] = 0;
                            $app_config_model->createConfig($data);
                        } else {
                            $app_config_model->updateConfig(["uniacid" => $uniacid], $data);
                        }
                        longbingGetAppConfig($uniacid, true);
                    }
                }
                $oss_config = longbingGetOssConfig($uniacid);
                if(empty($oss_config) || empty($oss_config["is_sync"])) {
                    $weiqing_oss = NULL;
                    if(isset($_W["setting"]["remote_complete_info"][$_W["uniacid"]])) {
                        $weiqing_oss = $_W["setting"]["remote_complete_info"][$_W["uniacid"]];
                    }
                    if(empty($weiqing_oss) && isset($_W["setting"]["remote_complete_info"])) {
                        $weiqing_oss = $_W["setting"]["remote_complete_info"];
                    }
                    if(!empty($weiqing_oss)) {
                        $data = ["is_sync" => 1];
                        if(isset($weiqing_oss["qiniu"])) {
                            $data["open_oss"] = 2;
                            if(isset($weiqing_oss["qiniu"]["accesskey"]) && !empty($weiqing_oss["qiniu"]["accesskey"])) {
                                $data["qiniu_accesskey"] = $weiqing_oss["qiniu"]["accesskey"];
                            }
                            if(isset($weiqing_oss["qiniu"]["secretkey"]) && !empty($weiqing_oss["qiniu"]["secretkey"])) {
                                $data["qiniu_secretkey"] = $weiqing_oss["qiniu"]["secretkey"];
                            }
                            if(isset($weiqing_oss["qiniu"]["bucket"]) && !empty($weiqing_oss["qiniu"]["bucket"])) {
                                $data["qiniu_bucket"] = $weiqing_oss["qiniu"]["bucket"];
                            }
                            if(isset($weiqing_oss["qiniu"]["url"]) && !empty($weiqing_oss["qiniu"]["url"])) {
                                $data["qiniu_yuming"] = $weiqing_oss["qiniu"]["url"];
                            }
                        }
                        $oss_config_model = new \app\admin\model\OssConfig();
                        if(empty($oss_config)) {
                            $data["uniacid"] = $uniacid;
                            $oss_config_model->createConfig($data);
                        } else {
                            $oss_config_model->updateConfig(["uniacid" => $uniacid], $data);
                        }
                        longbingGetOssConfig($uniacid, true);
                    }
                }
                longbingGetCompanyConfig($uniacid);
            }
        }
    }
}

?>